package com.xssn.util.exception;


import com.xssn.util.enums.ResultEnum;
import lombok.Data;

@Data
public class XssnException extends RuntimeException{

    //异常状态码
    private Integer code;

    /**
     * 通过状态码和错误消息创建异常对象
     * @param code
     * @param desc
     */
    public XssnException( Integer code,String desc) {
        super(desc);
        this.code = code;
    }


    /**
     * 接收枚举类型对象
     * @param resultEnum
     */
    public XssnException(ResultEnum resultEnum) {
        super(resultEnum.getDesc());
        this.code = resultEnum.getCode();
    }

}
